<?php
/**
* SocialEngine
*
* @category   Application_Extensions
* @package    Flashgame
* @version    $Id: Level.php 6072 2010 YouNet $
* @author     To Anh
*/

class Flashgame_Form_Admin_Level extends Authorization_Form_Admin_Level_Abstract
{
    public function init()
    {
    	parent::init();
        $this
        ->setTitle('Member Level Settings')
        ->setDescription("FLASHGAME_FORM_ADMIN_LEVEL_DESCRIPTION");
        
/*
        $this->loadDefaultDecorators();
        $this->getDecorator('Description')->setOptions(array('tag' => 'h4', 'placement' => 'PREPEND'));

        // prepare user levels
        $table = Engine_Api::_()->getDbtable('levels', 'authorization');
        $select = $table->select();
        $user_levels = $table->fetchAll($select);

        foreach ($user_levels as $user_level){
            $levels_prepared[$user_level->level_id]= $user_level->getTitle();
        }

        // category field
        $this->addElement('Select', 'level_id', array(s
        'label' => 'Member Level',
        'multiOptions' => $levels_prepared,
        'onchange' => 'javascript:fetchLevelSettings(this.value);',
        'value' => '3'
        ));
*/
        $this->addElement('Radio', 'view', array(
        'label' => 'Allow Viewing of Games?',
        'description' => 'Do you want to let members view games? If set to no, some other settings on this page may not apply.',
        'multiOptions' => array(
        0 => 'No, do not allow games to be viewed.',
        1 => 'Yes, allow viewing of games.',
        2 => 'Yes, allow viewing of all games, even private ones.'
        ),
     'value' => ( $this->isModerator() ? 2 : 1 ),
    ));
    if( !$this->isModerator() ) {
      unset($this->view->options[2]);
    }
    if( !$this->isPublic() ) {
        $this->addElement('Radio', 'edit', array(
        'label' => 'Allow Editing of Games?',
        'description' => 'Do you want to let members edit games? If set to no, some other settings on this page may not apply.',
        'multiOptions' => array(
        0 => 'No, do not allow members to edit their games.',
        1 => 'Yes, allow members to edit their own games.',
        2 => 'Yes, allow members to edit all games.'
        ),
		'value' => ( $this->isModerator() ? 2 : 1 ),
      ));
      if( !$this->isModerator() ) {
        unset($this->edit->options[2]);
      }
        $this->addElement('Radio', 'delete', array(
        'label' => 'Allow Deletion of Games?',
        'description' => 'Do you want to let members delete games? If set to no, some other settings on this page may not apply.',
        'multiOptions' => array(
        0 => 'No, do not allow members to delete their games.',
        1 => 'Yes, allow members to delete their own games.',
        2 => 'Yes, allow members to delete all games.'
        ),
        'value' => ( $this->isModerator() ? 2 : 1 ),
      ));
      if( !$this->isModerator() ) {
        unset($this->delete->options[2]);
      }
        $this->addElement('Radio', 'create', array(
        'label' => 'Allow Creation of Games?',
        'description' => 'FLASHGAME_FORM_ADMIN_LEVEL_CREATE_DESCRIPTION',
        'multiOptions' => array(
        1 => 'Yes, allow creation of games.',
        0 => 'No, do not allow games to be created.'
        ),
        'value' => 1,
        ));

        // PRIVACY ELEMENTS
        $this->addElement('MultiCheckbox', 'auth_view', array(
        'label' => 'Games Privacy',
        'description' => 'FLASHGAME_FORM_ADMIN_LEVEL_AUTHVIEW_DESCRIPTION',
        'multiOptions' => array(
        'everyone'       => 'Everyone',
        'owner_network' => 'Friends and Networks',
        'owner_member_member'  => 'Friends of Friends',
        'owner_member'         => 'Friends Only',
        'owner'          => 'Just Me'
        ),
        'value' => array('everyone', 'owner_network','owner_member_member', 'owner_member', 'owner')
        ));

        $this->addElement('MultiCheckbox', 'auth_comment', array(
        'label' => 'Game Comment Options',
        'description' => 'FLASHGAME_FORM_ADMIN_LEVEL_AUTHCOMMENT_DESCRIPTION',
        'description' => '',
        'multiOptions' => array(
        'everyone'       => 'Everyone',
        'owner_network' => 'Friends and Networks',
        'owner_member_member'  => 'Friends of Friends',
        'owner_member'         => 'Friends Only',
        'owner'          => 'Just Me'
        ),
        'value' => array('everyone', 'owner_network','owner_member_member', 'owner_member', 'owner')
        ));

        $this->addElement('Text', 'max', array(
        'label' => 'Maximum Allowed Games',
        'description' => 'Enter the maximum number of allowed games. The field must contain an integer between 1 and 999.'
        ));

   /*     $this->addElement('Button', 'submit', array(
        'label' => 'Save Settings',
        'type' => 'submit',
        ));
*/
    }
    }
}